/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui2;

import entity.Customer;
import entity.ViewCart;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

/**
 *
 * @author Windows7
 */
public class GUIMenuCustomer extends javax.swing.JInternalFrame {

    private Customer customer;
    static ArrayList<ViewCart> listCart = new ArrayList<ViewCart>();
    // FrCustomer c = new FrCustomer(title);

    /**
     * Creates new form GUIMenuCustomer
     */
    //String username;
    // private FrCustomer frCustomer;
    public GUIMenuCustomer(Customer customer) {
        try {
            Calendar now = Calendar.getInstance();
            String[] strDays = new String[]{
                "Sunday",
                "Monday",
                "Tuesday",
                "Wednesday",
                "Thusday",
                "Friday",
                "Saturday"
            };
            initComponents();
            this.setResizable(false);
//            this.setTitle("Menu Customer");
            this.customer = customer;
            lblValueDay.setText(strDays[now.get(Calendar.DAY_OF_WEEK)]);
            management.MyConnection.getConnection();
            management.GUIInteraction.readToTable("select * from  Menu where DayofWeek = '" + lblValueDay.getText() + "'", tblMenuCus2);
            Date todayID = new Date(System.currentTimeMillis());
            SimpleDateFormat dayFomat = new SimpleDateFormat("yyyy-MM-dd");
            String today = dayFomat.format(todayID.getTime());


            //neu khach hang no qua 30 ngay thi tinh nang chon mon an se bi disable.
            Statement st = management.MyConnection.getStatement();
            ResultSet rs = st.executeQuery("select * from Bill where Customer_Id = '" + customer.getId() + "' and  ('" + today + "' - Create_Date) > 2 and Pay = 0");
            if (rs.next()) {
                JOptionPane.showMessageDialog(this, "Ban da no qua 30 ngay, nen ban k the dat hang nua.");
                btnCart2.setEnabled(false);
                btnViewCart2.setEnabled(false);

            }
        } catch (SQLException ex) {
            Logger.getLogger(GUIMenuCustomer.class.getName()).log(Level.SEVERE, null, ex);
        }

    }

    public void refresh() {
        cbxNumber2.setSelectedIndex(0);
        txtMenuId2.setText("");
        txtMenu2.setText("");
        txtMenuPrice2.setText("");
        cbxDayS2.setSelectedIndex(0);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblValue1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        cbxDayS2 = new javax.swing.JComboBox();
        lblMenuH2 = new javax.swing.JLabel();
        lblDayS2 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tblMenuCus2 = new javax.swing.JTable();
        lblValueDay = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        lblMneu2 = new javax.swing.JLabel();
        btnViewCart2 = new javax.swing.JButton();
        txtMenu2 = new javax.swing.JTextField();
        btnViewMenu2 = new javax.swing.JButton();
        lblNumber2 = new javax.swing.JLabel();
        txtMenuId2 = new javax.swing.JTextField();
        cbxNumber2 = new javax.swing.JComboBox();
        lblMenuItem2 = new javax.swing.JLabel();
        btnCart2 = new javax.swing.JButton();
        txtMenuPrice2 = new javax.swing.JTextField();
        lblMenu_Id2 = new javax.swing.JLabel();

        setPreferredSize(new java.awt.Dimension(1024, 650));

        lblValue1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
        jLabel2.setText("Menu of : ");
        jLabel2.setPreferredSize(new java.awt.Dimension(60, 25));

        cbxDayS2.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        cbxDayS2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Monday", "Tuesday ", "Wednesday ", "Thursday ", "Friday ", "Saturday ", "Sunday" }));
        cbxDayS2.setPreferredSize(new java.awt.Dimension(95, 30));
        cbxDayS2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbxDayS2ActionPerformed(evt);
            }
        });

        lblMenuH2.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
        lblMenuH2.setForeground(new java.awt.Color(102, 0, 102));
        lblMenuH2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblMenuH2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/menu.png"))); // NOI18N
        lblMenuH2.setText("  MENU");
        lblMenuH2.setPreferredSize(new java.awt.Dimension(60, 50));

        lblDayS2.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
        lblDayS2.setText("Day Of Week :");
        lblDayS2.setPreferredSize(new java.awt.Dimension(100, 25));

        tblMenuCus2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblMenuCus2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblMenuCus2MouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tblMenuCus2);

        lblValueDay.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
        lblValueDay.setPreferredSize(new java.awt.Dimension(50, 25));

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        lblMneu2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblMneu2.setText("Menu :");
        lblMneu2.setPreferredSize(new java.awt.Dimension(65, 25));

        btnViewCart2.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
        btnViewCart2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/viewCart.png"))); // NOI18N
        btnViewCart2.setText("View Cart");
        btnViewCart2.setPreferredSize(new java.awt.Dimension(120, 30));
        btnViewCart2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnViewCart2ActionPerformed(evt);
            }
        });

        txtMenu2.setEditable(false);
        txtMenu2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtMenu2.setPreferredSize(new java.awt.Dimension(65, 25));

        btnViewMenu2.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
        btnViewMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/viewMenu.png"))); // NOI18N
        btnViewMenu2.setText("View Menu");
        btnViewMenu2.setPreferredSize(new java.awt.Dimension(120, 30));
        btnViewMenu2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnViewMenu2ActionPerformed(evt);
            }
        });

        lblNumber2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblNumber2.setText("Number :");
        lblNumber2.setPreferredSize(new java.awt.Dimension(65, 25));

        txtMenuId2.setEditable(false);
        txtMenuId2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtMenuId2.setPreferredSize(new java.awt.Dimension(65, 25));

        cbxNumber2.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
        cbxNumber2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5" }));
        cbxNumber2.setPreferredSize(new java.awt.Dimension(40, 25));

        lblMenuItem2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblMenuItem2.setText("MenuPrice :");
        lblMenuItem2.setPreferredSize(new java.awt.Dimension(65, 25));

        btnCart2.setFont(new java.awt.Font("Times New Roman", 1, 16)); // NOI18N
        btnCart2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/CartAdd.png"))); // NOI18N
        btnCart2.setText("Cart");
        btnCart2.setPreferredSize(new java.awt.Dimension(120, 30));
        btnCart2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCart2ActionPerformed(evt);
            }
        });

        txtMenuPrice2.setEditable(false);
        txtMenuPrice2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtMenuPrice2.setPreferredSize(new java.awt.Dimension(65, 25));
        txtMenuPrice2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtMenuPrice2ActionPerformed(evt);
            }
        });

        lblMenu_Id2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblMenu_Id2.setText("Menu_Id :");
        lblMenu_Id2.setPreferredSize(new java.awt.Dimension(65, 25));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblMenuItem2, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblNumber2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(30, 30, 30)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cbxNumber2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMenuPrice2, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblMenu_Id2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblMneu2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(30, 30, 30)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtMenuId2, javax.swing.GroupLayout.DEFAULT_SIZE, 205, Short.MAX_VALUE)
                            .addComponent(txtMenu2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnViewCart2, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnViewMenu2, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCart2, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(210, 210, 210))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblMenu_Id2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtMenuId2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnCart2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblMneu2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMenu2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(24, 24, 24)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblMenuItem2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txtMenuPrice2, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbxNumber2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblNumber2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addComponent(btnViewCart2, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(32, 32, 32)
                        .addComponent(btnViewMenu2, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 77, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(lblValueDay, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(44, 44, 44)
                .addComponent(lblValue1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblDayS2, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addComponent(cbxDayS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(60, 60, 60))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(284, Short.MAX_VALUE)
                .addComponent(lblMenuH2, javax.swing.GroupLayout.PREFERRED_SIZE, 443, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(281, 281, 281))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 988, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(lblMenuH2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addComponent(lblValue1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lblDayS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(cbxDayS2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(38, 38, 38)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblValueDay, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnViewMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewMenu2ActionPerformed
        try {
            // TODO add your handling code here:
//            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            management.GUIInteraction.readToTable(management.ManagerMenu.sqlTbl_Menu, tblMenuCus2);
        } catch (SQLException ex) {
            Logger.getLogger(GUIMenuCustomer.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (ClassNotFoundException ex) {
//            Logger.getLogger(GUIMenuCustomer.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            Logger.getLogger(GUIMenuCustomer.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            Logger.getLogger(GUIMenuCustomer.class.getName()).log(Level.SEVERE, null, ex);
//        } catch (UnsupportedLookAndFeelException ex) {
//            Logger.getLogger(GUIMenuCustomer.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_btnViewMenu2ActionPerformed

    private void cbxDayS2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxDayS2ActionPerformed
        // TODO add your handling code here:
        String searchD = String.valueOf(cbxDayS2.getSelectedItem());
        try {
            management.GUIInteraction.readToTable("select * from Menu where DayofWeek = '" + searchD + "'", tblMenuCus2);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_cbxDayS2ActionPerformed

    private void btnCart2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCart2ActionPerformed
        // TODO add your handling code here:
        try {
            int i = tblMenuCus2.getSelectedRow();
            if (i == -1) {
                JOptionPane.showMessageDialog(rootPane, "You don't choise row!");
            } else {
                Float pr = Float.valueOf(txtMenuPrice2.getText());
                int num = Integer.valueOf(cbxNumber2.getSelectedItem().toString());
                ViewCart vc = new ViewCart();
                vc.setMenu_Id(Integer.valueOf(txtMenuId2.getText().toString()));
                vc.setMenu(txtMenu2.getText());
                vc.setMenuPrice(pr);
                vc.setNumber(num);
                management.ManagerViewCart.addViewCart(vc);
                JOptionPane.showMessageDialog(this, "Add cart successfull !");
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }//GEN-LAST:event_btnCart2ActionPerformed

    private void btnViewCart2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnViewCart2ActionPerformed
        // TODO add your handling code here:
        ViewCart v = new ViewCart();
        ArrayList<ViewCart> list = management.ManagerViewCart.addViewCart(v);
        FrViewCart viewC = new FrViewCart(list, this.customer);
        viewC.setVisible(true);
    }//GEN-LAST:event_btnViewCart2ActionPerformed

    private void txtMenuPrice2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtMenuPrice2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtMenuPrice2ActionPerformed

    private void tblMenuCus2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblMenuCus2MouseClicked
        // TODO add your handling code here:
        int i = tblMenuCus2.getSelectedRow();
        txtMenuId2.setText(String.valueOf(tblMenuCus2.getValueAt(i, 0)));
        txtMenu2.setText(String.valueOf(tblMenuCus2.getValueAt(i, 2 )));
        txtMenuPrice2.setText(String.valueOf(tblMenuCus2.getValueAt(i,4 )));
    }//GEN-LAST:event_tblMenuCus2MouseClicked
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCart2;
    private javax.swing.JButton btnViewCart2;
    private javax.swing.JButton btnViewMenu2;
    private javax.swing.JComboBox cbxDayS2;
    private javax.swing.JComboBox cbxNumber2;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JLabel lblDayS2;
    private javax.swing.JLabel lblMenuH2;
    private javax.swing.JLabel lblMenuItem2;
    private javax.swing.JLabel lblMenu_Id2;
    private javax.swing.JLabel lblMneu2;
    private javax.swing.JLabel lblNumber2;
    private javax.swing.JLabel lblValue1;
    private javax.swing.JLabel lblValueDay;
    private javax.swing.JTable tblMenuCus2;
    private javax.swing.JTextField txtMenu2;
    private javax.swing.JTextField txtMenuId2;
    private javax.swing.JTextField txtMenuPrice2;
    // End of variables declaration//GEN-END:variables
    JLabel lblusername = new JLabel();
}
